<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let p = new Promise((resolve, reject)=>{
            // reject('error');
            resolve('ok');
        })

        // 默认失败回调： 
        // reason=>{
        //     return new Promise((resolve, reject)=>reject(reason))
        // }

        // let res = p.then(value=>{
        //     console.log(value);
        // })
        // .then(value=>{
        //     console.log(value);
        // },reason=>{
        //     console.log(reason);
        // })

        // console.log('res: ', res);


        // 默认成功的回调 value=>value
        let res = p.then()
        .then(value=>{
            console.log('第二个then成功的回调');
            console.log(value);
        },reason=>{
            console.log(reason);
        })

        console.log('res: ', res);

        
    </script>
</body>
</html>